package com.twu.biblioteca.Models;

import java.util.ArrayList;

/**
 * Created with IntelliJ IDEA.
 * User: spacetime
 * Date: 16/8/13
 * Time: 3:15 AM
 */
public class MovieLibrary {

    private ArrayList<Movie> movieArrayList;

    public MovieLibrary() {
        movieArrayList = new ArrayList<Movie>();
    }

    public static String getMovieHeaderString() {
        return Movie.getMovieHeaderString();
    }

    public void addMovie(Movie movie) {
        movieArrayList.add(movie);
    }

    public String getCompleteListing() {
        StringBuilder completeListingBuilder = new StringBuilder();
        completeListingBuilder.append(getMovieHeaderString());
        completeListingBuilder.append("\n");
        for (Movie movie : movieArrayList) {
            completeListingBuilder.append(movie.getMovieString());
            completeListingBuilder.append("\n");
        }

        return completeListingBuilder.toString();
    }

    public static void addMovieToLibrary(MovieLibrary movieLibrary, String name,
                                        int year, String director, float rating) {
        Movie movie = new Movie(name, year, director, rating);
        movieLibrary.addMovie(movie);
    }

}
